//
//  HSScoreModel.swift
//  HomeSchoolDemo
//
//  Created by rimi on 16/10/10.
//  Copyright © 2016年 黄华强. All rights reserved.
//

import UIKit
//分数模型
class HSScoreModel: NSObject {

    var es_title:String?
    var es_createDate:String?
    var es_teacherName:String?
    var es_score:Int = 0
    var es_course:String?
    var es_id:Int = 0
    var es_tId:Int = 0
    var es_comment:String?
    
    
    var cellHeight:CGFloat = 0
    
    var isShowComment:Bool = false {
        didSet {
            computeCellH()
        }
    }
    
    
    init(dict: [String:Any]) {
        super.init()

        setValuesForKeys(dict)
        computeCellH()
    }

   fileprivate func computeCellH() {
    if isShowComment {
        let maxSize = CGSize(width: screenW - 16, height: CGFloat(MAXFLOAT))
        let contentH = ((es_comment ?? "") as NSString).boundingRect(with: maxSize, options: NSStringDrawingOptions.usesLineFragmentOrigin, attributes: [NSFontAttributeName:UIFont.systemFont(ofSize: 13)], context: nil).size.height
        cellHeight = contentH + 84
    } else {
        cellHeight = 68
    }
    
    
    }
    
}
/*
 "es_title": 数学单元测试,
 "es_createDate": 2016-07-07, 
 "es_teacherName": 老师1, 
 "es_score": 64, 
 "es_course": 数学, 
 "es_id": 8, 
 "es_tId": 1, 
 "es_comment": 及格，还要多加努力……
 */
